package il.ac.braude.sona.gui.mytables;


import il.ac.braude.sona.constants.Resources;
import il.ac.braude.sona.entities.ChangeRequest;
import il.ac.braude.sona.gui.infogui.RequsetInfoFrame;
import il.ac.braude.sona.gui.list_table.ListTable;
import il.ac.braude.sona.gui.list_table.ListTableClickAdapter;
import il.ac.braude.sona.gui.list_table.ListTableFrame;

/**
 * Determines specific table frame for change request.
 * @author  Ofek Ron
 * @author Avihay Avitan
 * @author Nitzan Inbar
 * @author Sasha Rozenthal
 * Group 6,<br>Laboratory in Software Engineering,Ort Braude College.</p>
 *
 */
@SuppressWarnings("serial")
public class ChangeRequestTableFrame extends ListTableFrame<ChangeRequest> {

	/**
	 * Class constructor.
	 */
	public ChangeRequestTableFrame() {
		super(Resources.Strings.ViewAllRequests);
	}
/**
 * Sets new table.
 * 
 * @param changeRequestTableModel type of table needed.
 */
	public void setTable(ChangeRequestTableModel changeRequestTableModel) {
		final ListTable<ChangeRequest> table = new ListTable<ChangeRequest>(changeRequestTableModel);
		table.addListTableClickListener(new ListTableClickAdapter<ChangeRequest>() {
			@Override
			public void onDoubleClick(ChangeRequest t) {
				new RequsetInfoFrame(t);
				ChangeRequestTableFrame.this.dispose();
			}
		});
		super.setTable(table);

	}

}
